/**
 * 路由模块配置文件
 */

import Vue from 'vue'
import VueRouter from 'vue-router'

const Login = () => import('@/views/login/')
const Layout = () => import('@/views/layout/')
const Home = () => import('@/views/home/')
const Category = () => import('@/views/category/')
const Shopcart = () => import('@/views/shopcart/')
const User = () => import('@/views/user/')
const Detail = () => import('@/views/detail/')

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '',
        name: 'home',
        component: Home
      },
      {
        path: '/category',
        name: 'category',
        component: Category
      },
      {
        path: '/shopcart',
        name: 'shopcart',
        component: Shopcart
      },
      {
        path: '/user',
        name: 'user',
        component: User
      }
    ]
  },
  {
    path: '/detail',
    name: 'detail',
    component: Detail
  }
]

const router = new VueRouter({
  routes
})

export default router
